package com.manage.project.biz.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.manage.framework.aspectj.lang.annotation.Log;
import com.manage.framework.aspectj.lang.enums.BusinessType;
import com.manage.project.biz.domain.BizTujianjiegoubingchongchuzhi;
import com.manage.project.biz.service.IBizTujianjiegoubingchongchuzhiService;
import com.manage.framework.web.controller.BaseController;
import com.manage.framework.web.domain.AjaxResult;
import com.manage.common.utils.poi.ExcelUtil;
import com.manage.framework.web.page.TableDataInfo;

/**
 Controller
 *
 * @author liutao
 *
 */
@RestController
@RequestMapping("/biz/tujianjiegoubingchongchuzhi")
public class BizTujianjiegoubingchongchuzhiController extends BaseController
{
    @Autowired
    private IBizTujianjiegoubingchongchuzhiService bizTujianjiegoubingchongchuzhiService;

    /**
     * 查询病虫处治列表
     */
//    @PreAuthorize("@ss.hasPermi('biz:tujianjiegoubingchongchuzhi:list')")
    @GetMapping("/list")
    public TableDataInfo list(BizTujianjiegoubingchongchuzhi bizTujianjiegoubingchongchuzhi)
    {
        startPage();
        List<BizTujianjiegoubingchongchuzhi> list = bizTujianjiegoubingchongchuzhiService.selectBizTujianjiegoubingchongchuzhiList(bizTujianjiegoubingchongchuzhi);
        return getDataTable(list);
    }

    /**
     * 导出病虫处治列表
     */
//    @PreAuthorize("@ss.hasPermi('biz:tujianjiegoubingchongchuzhi:export')")
    @Log(title = "病虫处治", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(BizTujianjiegoubingchongchuzhi bizTujianjiegoubingchongchuzhi)
    {
        List<BizTujianjiegoubingchongchuzhi> list = bizTujianjiegoubingchongchuzhiService.selectBizTujianjiegoubingchongchuzhiList(bizTujianjiegoubingchongchuzhi);
        ExcelUtil<BizTujianjiegoubingchongchuzhi> util = new ExcelUtil<BizTujianjiegoubingchongchuzhi>(BizTujianjiegoubingchongchuzhi.class);
        return util.exportExcel(list, "病虫处治数据");
    }

    /**
     * 获取病虫处治详细信息
     */
//    @PreAuthorize("@ss.hasPermi('biz:tujianjiegoubingchongchuzhi:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(bizTujianjiegoubingchongchuzhiService.selectBizTujianjiegoubingchongchuzhiById(id));
    }

    /**
     * 新增病虫处治
     */
//    @PreAuthorize("@ss.hasPermi('biz:tujianjiegoubingchongchuzhi:add')")
    @Log(title = "病虫处治", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BizTujianjiegoubingchongchuzhi bizTujianjiegoubingchongchuzhi)
    {

        return toAjax(bizTujianjiegoubingchongchuzhiService.insertBizTujianjiegoubingchongchuzhi(bizTujianjiegoubingchongchuzhi));
    }

    /**
     * 修改病虫处治
     */
    @Log(title = "病虫处治", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BizTujianjiegoubingchongchuzhi bizTujianjiegoubingchongchuzhi)
    {
        return toAjax(bizTujianjiegoubingchongchuzhiService.updateBizTujianjiegoubingchongchuzhi(bizTujianjiegoubingchongchuzhi));
    }

    /**
     * 删除病虫处治
     */
//    @PreAuthorize("@ss.hasPermi('biz:tujianjiegoubingchongchuzhi:remove')")
    @Log(title = "病虫处治", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(bizTujianjiegoubingchongchuzhiService.deleteBizTujianjiegoubingchongchuzhiByIds(ids));
    }
}
